<navigation:Page xmlns:my="clr-namespace:System.Windows.Controls;assembly=RichTextEdit"  xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  x:Class="Imtihan.Admin" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    d:DesignWidth="640" d:DesignHeight="300" mc:Ignorable="d"
    Style="{StaticResource PageStyle}" xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit">

    <Grid x:Name="LayoutRoot">
        <ScrollViewer VerticalScrollBarVisibility="Auto">
        <sdk:TabControl Name="tabAdmin" SelectionChanged="tabAdmin_SelectionChanged" ScrollViewer.VerticalScrollBarVisibility="Auto">
            <sdk:TabItem Header="Answer">
                <StackPanel>
                    <Grid>
                        <sdk:DataGrid AutoGenerateColumns="False" Height="300" HorizontalAlignment="Left" Name="dgAnswer" VerticalAlignment="Top" HorizontalContentAlignment="Stretch" SelectionMode="Single" AllowDrop="True">
                        <sdk:DataGrid.Columns>
                            <sdk:DataGridTextColumn Header="Words" Binding="{Binding Words}" />
                                <sdk:DataGridTemplateColumn>
                                    <sdk:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Name="btnEdit" Content="Edit" Click="btnEdit_Click"/>
                                        </DataTemplate>
                                    </sdk:DataGridTemplateColumn.CellTemplate>
                                </sdk:DataGridTemplateColumn>
                                <sdk:DataGridTemplateColumn>
                                    <sdk:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Name="btnDelete" Content="Delete" Click="btnDelete_Click"/>
                                        </DataTemplate>
                                    </sdk:DataGridTemplateColumn.CellTemplate>
                                </sdk:DataGridTemplateColumn>
                            </sdk:DataGrid.Columns>
                    </sdk:DataGrid>
                       
                    </Grid>
                    <Grid Margin="10">
                        <StackPanel HorizontalAlignment="Left">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="50"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <sdk:Label Grid.Column="0" Content="Words: " />
                                <my:RichTextEdit Grid.Column="1" Name="rteAnswerWords" Width="500" Height="150" Grid.ColumnSpan="2"/>
                            </Grid>
                            <Grid Margin="10">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="50"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Button Content="Add" Width="100" Grid.ColumnSpan="2" Name="btnAdd" Click="btnAdd_Click" HorizontalAlignment="Right"/>
                                <Button Content="Cancel" Width="100" Grid.Column="2" Name="btnCancel" Click="btnCancel_Click" HorizontalAlignment="Left"/>
                            </Grid>

                        </StackPanel>
                    </Grid>
                </StackPanel>
            </sdk:TabItem>
            <sdk:TabItem Header="Assessment">
                <sdk:DataGrid Name="dgAssessment" AutoGenerateColumns="False">
                    <sdk:DataGrid.Columns>
                        <sdk:DataGridTextColumn Header="Name" Binding="{Binding Name}" />
                        <sdk:DataGridTextColumn Header="Number of Problem" Binding="{Binding MaxProblem}" />
                    </sdk:DataGrid.Columns>
                </sdk:DataGrid>
            </sdk:TabItem>
            <sdk:TabItem Header="Category">
                <StackPanel>
                    <Grid>
                        <sdk:DataGrid AutoGenerateColumns="False" Height="300" HorizontalAlignment="Left" Name="dgCategory" VerticalAlignment="Top" HorizontalContentAlignment="Stretch" SelectionMode="Single" AllowDrop="True">
                            <sdk:DataGrid.Columns>
                                <sdk:DataGridTextColumn Header="Name" Binding="{Binding Name}" />
                                <sdk:DataGridTemplateColumn>
                                    <sdk:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Name="btnEdit" Content="Edit" Click="btnEdit_Click"/>
                                        </DataTemplate>
                                    </sdk:DataGridTemplateColumn.CellTemplate>
                                </sdk:DataGridTemplateColumn>
                                <sdk:DataGridTemplateColumn>
                                    <sdk:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Name="btnDelete" Content="Delete" Click="btnDelete_Click"/>
                                        </DataTemplate>
                                    </sdk:DataGridTemplateColumn.CellTemplate>
                                </sdk:DataGridTemplateColumn>
                            </sdk:DataGrid.Columns>
                        </sdk:DataGrid>

                    </Grid>
                    <Grid Margin="10">
                        <StackPanel HorizontalAlignment="Left">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="50"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <sdk:Label Grid.Column="0" Content="Words: " />
                                <TextBox Name="tbCategory" Grid.Column="1" Grid.ColumnSpan="2" />
                                <!--<my:RichTextEdit Grid.Column="1" Name="rteAnswerWords" Width="500" Height="150" Grid.ColumnSpan="2"/>-->
                            </Grid>
                            <Grid Margin="10">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="50"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Button Content="Add" Width="100" Grid.ColumnSpan="2" Name="btnAddCategory" Click="btnAdd_Click" HorizontalAlignment="Right"/>
                                <Button Content="Cancel" Width="100" Grid.Column="2" Name="btnCancelCategory" Click="btnCancel_Click" HorizontalAlignment="Left"/>
                            </Grid>

                        </StackPanel>
                    </Grid>
                </StackPanel>
            </sdk:TabItem>
            <sdk:TabItem Header="Question">
                <StackPanel>
                    <Grid>
                        <sdk:DataGrid AutoGenerateColumns="False" Height="250" HorizontalAlignment="Left" Name="dgQuestion" VerticalAlignment="Top" HorizontalContentAlignment="Stretch" SelectionMode="Single" AllowDrop="True">
                            <sdk:DataGrid.Columns>
                                <sdk:DataGridTextColumn Header="Sentence" Binding="{Binding Sentence}" />
                                <sdk:DataGridTemplateColumn>
                                    <sdk:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Name="btnEdit" Content="Edit" Click="btnEdit_Click"/>
                                        </DataTemplate>
                                    </sdk:DataGridTemplateColumn.CellTemplate>
                                </sdk:DataGridTemplateColumn>
                                <sdk:DataGridTemplateColumn>
                                    <sdk:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Name="btnDelete" Content="Delete" Click="btnDelete_Click"/>
                                        </DataTemplate>
                                    </sdk:DataGridTemplateColumn.CellTemplate>
                                </sdk:DataGridTemplateColumn>
                            </sdk:DataGrid.Columns>
                        </sdk:DataGrid>

                    </Grid>
                    <Grid Margin="10">
                        <StackPanel HorizontalAlignment="Left">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="100"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <sdk:Label Grid.Column="0" Content="Sentence: " />
                                <my:RichTextEdit Grid.Column="1" Name="rteQuestionSentence" Width="500" Height="150" Grid.ColumnSpan="2"/>
                            </Grid>
                            <Grid Margin="10">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="50"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Button Content="Add" Width="100" Grid.ColumnSpan="2" Name="btnAddQuestion" Click="btnAdd_Click" HorizontalAlignment="Right"/>
                                <Button Content="Cancel" Width="100" Grid.Column="2" Name="btnCancelQuestion" Click="btnCancel_Click" HorizontalAlignment="Left"/>
                            </Grid>

                        </StackPanel>
                    </Grid>
                </StackPanel>
            </sdk:TabItem>
            <sdk:TabItem Header="Problem">
                <StackPanel>
                    <Grid>
                        <sdk:DataGrid AutoGenerateColumns="False" Height="250" HorizontalAlignment="Left" Name="dgProblem" VerticalAlignment="Top" HorizontalContentAlignment="Stretch" SelectionMode="Single" AllowDrop="True">
                            <sdk:DataGrid.Columns>
                                <sdk:DataGridTextColumn Header="Question" Binding="{Binding Question.Sentence}" />
                                <sdk:DataGridTextColumn Header="Category" Binding="{Binding Category.Name}" />
                                <sdk:DataGridTextColumn Header="Problem Type" Binding="{Binding Type}" />
                                <sdk:DataGridTemplateColumn>
                                    <sdk:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Name="btnEdit" Content="Edit" Click="btnEdit_Click"/>
                                        </DataTemplate>
                                    </sdk:DataGridTemplateColumn.CellTemplate>
                                </sdk:DataGridTemplateColumn>
                                <sdk:DataGridTemplateColumn>
                                    <sdk:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Name="btnDelete" Content="Delete" Click="btnDelete_Click"/>
                                        </DataTemplate>
                                    </sdk:DataGridTemplateColumn.CellTemplate>
                                </sdk:DataGridTemplateColumn>
                            </sdk:DataGrid.Columns>
                        </sdk:DataGrid>
                    </Grid>
                    <Grid Margin="10">
                        <StackPanel HorizontalAlignment="Left">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="150"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <sdk:Label Grid.Column="0" Content="Question: " />
                                <ComboBox Name="cbQuestion" SelectedValuePath="Id" DisplayMemberPath="Sentence" Grid.Column="1" Grid.ColumnSpan="2"/>
                            </Grid>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="150"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <sdk:Label Grid.Column="0" Content="Category: " />
                                <ComboBox Name="cbCategory" SelectedValuePath="Id" DisplayMemberPath="Name" Grid.Column="1" Grid.ColumnSpan="2"/>
                            </Grid>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="150"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <sdk:Label Grid.Column="0" Content="Problem Type (M/E): " />
                                <ComboBox Name="cbProblemType" SelectedValuePath="Code" DisplayMemberPath="Type" Grid.Column="1" Grid.ColumnSpan="2"/>
                            </Grid>
                            <Grid Margin="10">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="150"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Button Content="Add" Width="100" Grid.ColumnSpan="2" Name="btnAddProblem" Click="btnAdd_Click" HorizontalAlignment="Right"/>
                                <Button Content="Cancel" Width="100" Grid.Column="2" Name="btnCancelProblem" Click="btnCancel_Click" HorizontalAlignment="Left"/>
                            </Grid>

                        </StackPanel>
                    </Grid>
                </StackPanel>
            </sdk:TabItem>
            <sdk:TabItem Header="Problem's Answer">
                <StackPanel ScrollViewer.VerticalScrollBarVisibility="Auto">
                    <Grid Margin="10">
                        <StackPanel HorizontalAlignment="Left">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="150"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <sdk:Label Grid.Column="0" Content="Category: " />
                                <ComboBox Name="cbProblemCategory" SelectedValuePath="Id" DisplayMemberPath="Name" Grid.Column="1" Grid.ColumnSpan="2" SelectionChanged="cbProblemCategory_SelectionChanged"/>
                            </Grid>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="150"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <sdk:Label Grid.Column="0" Content="Question: " />
                                <ComboBox Name="cbProblemQuestion" SelectedValuePath="Question.Id" DisplayMemberPath="Question.Sentence" Grid.Column="1" Grid.ColumnSpan="2" SelectionChanged="cbProblemQuestion_SelectionChanged"/>
                            </Grid>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="150"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <sdk:Label Grid.Column="0" Content="Problem Type (M/E): " />
                                <ComboBox Name="cbProblemAnswerType" SelectedValuePath="Type" DisplayMemberPath="Type" Grid.Column="1" Grid.ColumnSpan="2" SelectionChanged="cbProblemAnswerType_SelectionChanged"/>
                            </Grid>

                        </StackPanel>
                    </Grid>
                    <Grid>
                        <sdk:DataGrid AutoGenerateColumns="False" Height="250" HorizontalAlignment="Left" Name="dgProblemAnswer" VerticalAlignment="Top" HorizontalContentAlignment="Stretch" SelectionMode="Single" AllowDrop="True">
                            <sdk:DataGrid.Columns>
                                <sdk:DataGridTextColumn Header="Answer" Binding="{Binding Answer.Words}" />
                                <sdk:DataGridTextColumn Header="Is Answer" Binding="{Binding IsAnswer}" />
                                <sdk:DataGridTemplateColumn>
                                    <sdk:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Name="btnDelete" Content="Delete" Click="btnDelete_Click"/>
                                        </DataTemplate>
                                    </sdk:DataGridTemplateColumn.CellTemplate>
                                </sdk:DataGridTemplateColumn>
                            </sdk:DataGrid.Columns>
                        </sdk:DataGrid>
                    </Grid>
                    <Grid Margin="10">
                        <StackPanel HorizontalAlignment="Left" ScrollViewer.VerticalScrollBarVisibility="Auto">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="150"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <sdk:Label Grid.Column="0" Content="Answer: " />
                                <ComboBox Name="cbAnswer" SelectedValuePath="Id" DisplayMemberPath="Words" Grid.Column="1" Grid.ColumnSpan="2"/>
                            </Grid>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="150"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <sdk:Label Grid.Column="0" Content="Is Answer: " />
                                <CheckBox Name="chkIsAnswer" Grid.Column="1" Grid.ColumnSpan="2"/>
                            </Grid>
                            <Grid Margin="10">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="150"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Button Content="Add" Width="100" Grid.ColumnSpan="2" Name="btnAddProblemAnswer" Click="btnAdd_Click" HorizontalAlignment="Right"/>
                                <Button Content="Cancel" Width="100" Grid.Column="2" Name="btnCancelProblemAnswer" Click="btnCancel_Click" HorizontalAlignment="Left"/>
                            </Grid>

                        </StackPanel>
                    </Grid>
                </StackPanel>
            </sdk:TabItem>
        </sdk:TabControl>
        </ScrollViewer>
    </Grid>

</navigation:Page>
